/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LianBao
 * Date: 2024-04-13
 * Time: 19:56
 */
public class Main {
    public static void main(String[] args) {
        Tree tree = new Tree();
        Tree.TreeNode root = tree.createTree();
        System.out.println("前序遍历:");
        tree.preOrder(root);
        System.out.println();
        System.out.println("中序遍历:");
        tree.inOrder(root);
        System.out.println();
        System.out.println("后序遍历:");
        tree.postOrder(root);
        System.out.println();
        System.out.println("层序遍历:");
        tree.levelOrder(root);
        System.out.println();
        System.out.println("结点个数:");
        System.out.println(tree.NodeSize(root));
        System.out.println();
        System.out.println("叶子结点个数:");
        System.out.println(tree.getLeafNodeCount(root));
        System.out.println();
        System.out.println("第k层结点个数:");
        System.out.println(tree.getKLevelNodeCount(root,2));
        System.out.println();
        System.out.println("树的高度:");
        System.out.println(tree.getHeight(root));
        System.out.println("是否存在某个值");
        System.out.println(tree.find(root,'A'));
        System.out.println("是否为完全二叉树");
        System.out.println(tree.isCompleteTree(root));
    }
}
